package edu.ubb.remeye.gui.event.manager;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import edu.ubb.remeye.control.Control;
import edu.ubb.remeye.gui.event.EventType;

/**
 * Class for managing mouse events.
 * 
 * @author Andrew Ianicicau
 *
 */
public class MouseEventManager extends MouseAdapter {

	///////////////////////////////////////////////////////////////////////////////////
	////		METHODS - MouseEventManager
	///////////////////////////////////////////////////////////////////////////////////
	
	/**
	 * Sends a mouse MOUSE_DOUBLE_CLICKED event on double click and MOUSE_CLICKED event on single click.
	 */
	@Override
	public void mouseClicked(MouseEvent e) {
		if(e.getClickCount() == 2)
			Control.sendEvent(EventType.MOUSE_DOUBLE_CLICKED, e);
		
		if(e.getClickCount() == 1)
			Control.sendEvent(EventType.MOUSE_CLICKED, e);
	}

	/**
	 * Sends a MOUSE_PRESSED event when mouse button is pressed.
	 */
	@Override
	public void mousePressed(MouseEvent e) {
		Control.sendEvent(EventType.MOUSE_PRESSED, e);
	}

	/**
	 * Sends a MOUSE_RELEASED event when mouse button is released.
	 */
	@Override
	public void mouseReleased(MouseEvent e) {
		Control.sendEvent(EventType.MOUSE_RELEASED, e);
	}
	
	

}
